package training;

import java.util.Scanner;
// https://www.nowcoder.com/questionTerminal/1046cd038f7a4b04b2b77b415973de1c
// 注意类名必须为 test.Main, 不要有任何 package xxx 信息
public class Day33_01 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) { // 注意 while 处理多个 case
            String s1 = in.next();
            String s2 = in.next();
            System.out.println(solution(s1, s2));
        }
//        String s1 = "1";
//        String s2 = " ";
//        System.out.println(solution(s1, s2));
    }
    public static int solution(String s1, String s2){
        int res = 0;
        int i = 0;
        for(int j = 0; j < s1.length(); j++){
            if(i < s2.length() && s1.charAt(j) == s2.charAt(i) ){
                while (i < s2.length() &&  j < s1.length() && s1.charAt(j) == s2.charAt(i)) {
                    i++;
                    j++;
                }
            } else {
                j++;
            }
            if(i == s2.length()){
                res++;
            }
            j--;
            i = 0;
        }
        return res;
    }
    // 库函数做法
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) { // 注意 while 处理多个 case
            String s = in.next();
            String t = in.next();
            System.out.println(cal(s, t));
        }
    }

    private static int cal(String s, String t) {
        int index = s.indexOf(t);
        if (index == -1) {
            return 0;
        }
        return 1 + cal(s.substring(index + t.length()), t);
    }
}
